package com.bruce.demo2.patterns.demo2.structural.demo11.composite;

/**
 * @PROJECT_NAME: design_patterns
 * @DESCRIPTION: 菜单项
 * @AUTHOR: CNBruceLee
 * @DATE: 2021/7/30 20:56
 */
public class MenuItem extends MenuComponent {
    public MenuItem(String name, int level, MenuComponent parentMenu) {
        super(name, level, parentMenu);
    }

    @Override
    public void print() {
        for (int i = 0; i < this.level; i++) {
            System.out.print("--");
        }
        System.out.print(this.getName());
    }
}
